package com.esri.core.internal.tasks.d;

import com.esri.core.geometry.SpatialReference;
import com.esri.core.geometry.Unit;
import com.esri.core.tasks.na.AttributeParameterValue;
import com.esri.core.tasks.na.NAFeatures;
import com.esri.core.tasks.na.NAOutputLine;
import com.esri.core.tasks.na.NAOutputPolygon;
import com.esri.core.tasks.na.NATravelDirection;
import com.esri.core.tasks.na.UTurnRestriction;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class g extends c {
    private static final long serialVersionUID = 1;
    private NAFeatures r = null;
    private Double[] s = null;
    private String[] t = null;
    private Boolean u = null;
    private NAOutputPolygon v = NAOutputPolygon.SERVER_DEFAULT;
    private Boolean w = null;
    private Boolean x = null;
    private Boolean y = null;
    private Boolean z = null;
    private Boolean A = null;
    private Double B = null;
    private Unit.EsriUnit C = Unit.EsriUnit.UNKNOWN;
    private boolean D = false;
    private Long E = null;
    private NATravelDirection F = NATravelDirection.SERVER_DEFAULT;

    public NAFeatures a() {
        return this.r;
    }

    public void a(NAFeatures nAFeatures) {
        this.r = nAFeatures;
    }

    public Double[] b() {
        return this.s;
    }

    public void a(Double[] dArr) {
        this.s = dArr;
    }

    public String[] c() {
        return this.t;
    }

    public void c(String[] strArr) {
        this.t = strArr;
    }

    public Boolean d() {
        return this.u;
    }

    public void b(Boolean bool) {
        this.u = bool;
    }

    public NAOutputPolygon e() {
        return this.v;
    }

    public void a(NAOutputPolygon nAOutputPolygon) {
        this.v = nAOutputPolygon;
    }

    public Boolean f() {
        return this.w;
    }

    public void c(Boolean bool) {
        this.w = bool;
    }

    public Boolean g() {
        return this.x;
    }

    public void d(Boolean bool) {
        this.x = bool;
    }

    public Boolean h() {
        return this.y;
    }

    public void e(Boolean bool) {
        this.y = bool;
    }

    public Boolean i() {
        return this.z;
    }

    public void f(Boolean bool) {
        this.z = bool;
    }

    public Boolean j() {
        return this.A;
    }

    public void g(Boolean bool) {
        this.A = bool;
    }

    public Double k() {
        return this.B;
    }

    public void a(Double d) {
        this.B = d;
    }

    public Unit.EsriUnit l() {
        return this.C;
    }

    public void b(Unit.EsriUnit esriUnit) {
        this.C = esriUnit;
    }

    public boolean m() {
        return this.D;
    }

    public void a(boolean z) {
        this.D = z;
    }

    public Long n() {
        return this.E;
    }

    public void a(Long l) {
        this.E = l;
    }

    public NATravelDirection o() {
        return this.F;
    }

    public void a(NATravelDirection nATravelDirection) {
        this.F = nATravelDirection;
    }

    @Override // com.esri.core.internal.tasks.f
    public Map<String, String> generateRequestParams() throws Exception {
        LinkedHashMap linkedHashMap = (LinkedHashMap) H();
        if (this.i == NAOutputLine.STRAIGHT) {
            throw new IllegalArgumentException("Service Area Task does not support straight output lines.");
        }
        if (this.i != null) {
            linkedHashMap.put("outputLines", this.i.toString());
        }
        NAFeatures nAFeatures = this.r;
        if (nAFeatures != null) {
            linkedHashMap.put("facilities", nAFeatures.toJson());
        }
        Double[] dArr = this.s;
        if (dArr != null) {
            linkedHashMap.put("defaultBreaks", com.esri.core.internal.util.a.a(dArr, ","));
        }
        String[] strArr = this.t;
        if (strArr != null) {
            linkedHashMap.put("excludeSourcesFromPolygons", com.esri.core.internal.util.a.a(strArr, ","));
        }
        Boolean bool = this.u;
        if (bool != null) {
            linkedHashMap.put("mergeSimilarPolygonRanges", bool.toString());
        }
        if (this.v != NAOutputPolygon.SERVER_DEFAULT) {
            linkedHashMap.put("outputPolygons", this.v.toString());
        }
        Boolean bool2 = this.w;
        if (bool2 != null) {
            linkedHashMap.put("overlapLines", bool2.toString());
        }
        Boolean bool3 = this.x;
        if (bool3 != null) {
            linkedHashMap.put("overlapPolygons", bool3.toString());
        }
        Boolean bool4 = this.y;
        if (bool4 != null) {
            linkedHashMap.put("splitLinesAtBreaks", bool4.toString());
        }
        Boolean bool5 = this.z;
        if (bool5 != null) {
            linkedHashMap.put("splitPolygonsAtBreaks", bool5.toString());
        }
        Boolean bool6 = this.A;
        if (bool6 != null) {
            linkedHashMap.put("trimOuterPolygon", bool6.toString());
        }
        Double d = this.B;
        if (d != null) {
            linkedHashMap.put("trimPolygonDistance", d.toString());
        }
        if (this.C != Unit.EsriUnit.UNKNOWN) {
            linkedHashMap.put("trimPolygonDistance", this.B.toString());
        }
        linkedHashMap.put("returnFacilities", Boolean.toString(this.D));
        Long l = this.E;
        if (l != null) {
            linkedHashMap.put("timeOfDay", l.toString());
        }
        if (this.F != NATravelDirection.SERVER_DEFAULT) {
            linkedHashMap.put("travelDirection", this.F.toString());
        }
        return linkedHashMap;
    }

    public static g a(JsonParser jsonParser) throws Exception {
        if (com.esri.core.internal.util.d.c(jsonParser)) {
            g gVar = new g();
            while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                String currentName = jsonParser.getCurrentName();
                jsonParser.nextToken();
                if ("impedance".equals(currentName)) {
                    gVar.k = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : jsonParser.getText();
                } else if ("restrictions".equals(currentName)) {
                    gVar.l = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : b(jsonParser);
                } else if ("restrictUTurns".equals(currentName)) {
                    gVar.m = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : UTurnRestriction.get(jsonParser.getText());
                } else if ("accumulateAttributeNames".equals(currentName)) {
                    gVar.j = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : b(jsonParser);
                } else if ("attributeParameterValues".equals(currentName)) {
                    if (jsonParser.getCurrentToken() == JsonToken.VALUE_NULL) {
                        gVar.d = null;
                    } else {
                        ArrayList arrayList = new ArrayList();
                        if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
                            while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                                arrayList.add(AttributeParameterValue.fromJson(jsonParser));
                            }
                        }
                        gVar.d = arrayList.isEmpty() ? null : (AttributeParameterValue[]) arrayList.toArray(new AttributeParameterValue[arrayList.size()]);
                    }
                } else if ("outputSpatialReference".equals(currentName)) {
                    gVar.h = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : SpatialReference.fromJson(jsonParser);
                } else if ("useHierarchy".equals(currentName)) {
                    gVar.n = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Boolean.valueOf(jsonParser.getBooleanValue());
                } else if ("outputLineType".equals(currentName)) {
                    gVar.i = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : NAOutputLine.get(jsonParser.getText());
                } else if ("defaultBreaks".equals(currentName)) {
                    gVar.s = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : c(jsonParser);
                } else if ("excludeSourcesFromPolygons".equals(currentName)) {
                    gVar.t = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : b(jsonParser);
                } else if ("mergeSimilarPolygonRanges".equals(currentName)) {
                    gVar.u = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Boolean.valueOf(jsonParser.getBooleanValue());
                } else if ("outputLines".equals(currentName)) {
                    gVar.i = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : NAOutputLine.get(jsonParser.getText());
                } else if ("outputPolygons".equals(currentName)) {
                    gVar.v = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : NAOutputPolygon.get(jsonParser.getText());
                } else if ("overlapLines".equals(currentName)) {
                    gVar.w = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Boolean.valueOf(jsonParser.getBooleanValue());
                } else if ("overlapPolygons".equals(currentName)) {
                    gVar.x = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Boolean.valueOf(jsonParser.getBooleanValue());
                } else if ("splitLinesAtBreaks".equals(currentName)) {
                    gVar.y = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Boolean.valueOf(jsonParser.getBooleanValue());
                } else if ("splitPolygonsAtBreaks".equals(currentName)) {
                    gVar.z = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Boolean.valueOf(jsonParser.getBooleanValue());
                } else if ("trimOuterPolygon".equals(currentName)) {
                    gVar.A = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Boolean.valueOf(jsonParser.getBooleanValue());
                } else if ("trimPolygonDistance".equals(currentName)) {
                    gVar.B = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Double.valueOf(jsonParser.getDoubleValue());
                } else if ("trimPolygonDistanceUnits".equals(currentName)) {
                    gVar.C = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Unit.EsriUnit.get(jsonParser.getText());
                } else if ("travelDirection".equals(currentName)) {
                    gVar.F = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : NATravelDirection.get(jsonParser.getText());
                } else if ("timeOfDay".equals(currentName)) {
                    gVar.E = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Long.valueOf(jsonParser.getLongValue());
                } else {
                    jsonParser.skipChildren();
                }
            }
            return gVar;
        }
        return null;
    }
}
